Best way to convert between [Char] and [Word8]?

Posted by cmars232 on Stack Overflow See other posts from Stack Overflow or by cmars232
Published on 2011-01-15T21:47:10Z Indexed on 2011/01/15 21:53 UTC
Read the original article Hit count: 168

Filed under:
|
|
|
|

I'm new to Haskell and I'm trying to use a pure SHA1 implementation in my app (Data.Digest.Pure.SHA) with a JSON library (AttoJSON).

AttoJSON uses Data.ByteString.Char8 bytestrings, SHA uses Data.ByteString.Lazy bytestrings, and some of my string literals in my app are [Char].

This article seems to indicate this is something still being worked out in the Haskell language/Prelude: http // hackage.haskell.org/trac/haskell-prime/wiki/CharAsUnicode

And this one lists a few libraries but its a couple years old: http //blog.kfish.org/2007/10/survey-haskell-unicode-support.html

[Links broken because SO doesn't trust me -- whatever...]

What is the current best way to convert between these types, and what are some of the tradeoffs? I don't want to pick something that is obsolete...

Thanks!

© Stack Overflow or respective owner

Related posts about string

Related posts about unicode